% ---- Determine l'orientation de la section NS ou EW
NS=nanmax(nanmax(nmodel.lat))-nanmin(nanmin(nmodel.lat));
EW=nanmax(nanmax(nmodel.lon))-nanmin(nanmin(nmodel.lon));
if ( NS > EW )
    X=dat.latdata;
    Xt='Latitude';
else
    X=dat.londata;
    Xt='Longitude';
end

% ---- Cas particulier
if (strcmp(cruise,'a25'))
    X=dat.timedata;
    Xt='Time';
end

mi=min(nanmin(nanmin(dat.data)),nanmin(nanmin(nmodel.data)));
ma=max(nanmax(nanmax(dat.data)),nanmax(nanmax(nmodel.data)));

switch parameter
    case 'T'
        md=5;
    case 'S'
        md=1;
        mi=32;
        ma=37;
    otherwise
        md=2*nanstd(nanstd(abs(nmodel.data-dat.data)));
end

% ---- data
close all
figure
h=scatter(reshape(X,1,size(X,1)*size(X,2)),...
    reshape(-dat.depthdata,1,size(-dat.depthdata,1)*size(-dat.depthdata,2)),30,...
    reshape(dat.data,1,size(dat.data,1)*size(dat.data,2)));
set(h,'Marker','s','MarkerFaceColor','flat')
caxis([mi ma])
xlabel(Xt)
title(['Data ',kind,' ',parameter,' ',cruise])
set(gca,'TickDir','out')
colorbar
printgc('-f1','-depsc2',['./PLOT_VALIDATION/',upper(kind),'/',kind,'_data_',cruise,'_',parameter,'_',bbio,'_y',year,'.eps'])

% ---- model
close all
figure
h=scatter(reshape(X,1,size(X,1)*size(X,2)),...
    reshape(-nmodel.depth,1,size(-nmodel.depth,1)*size(-nmodel.depth,2)),30,...
    reshape(nmodel.data,1,size(nmodel.data,1)*size(nmodel.data,2)));
set(h,'Marker','s','MarkerFaceColor','flat')
caxis([mi ma])
xlabel(Xt)
title(['Model ',kind,' ',parameter,' ',cruise])
set(gca,'TickDir','out')
colorbar
printgc('-f1','-depsc2',['./PLOT_VALIDATION/',upper(kind),'/',kind,'_model_',cruise,'_',parameter,'_',bbio,'_y',year,'.eps'])

% ---- model-data
close all
figure
h=scatter(reshape(X,1,size(X,1)*size(X,2)),...
    reshape(-nmodel.depth,1,size(-nmodel.depth,1)*size(-nmodel.depth,2)),30,...
    reshape((nmodel.data-dat.data),1,size(nmodel.data,1)*size(nmodel.data,2)));
set(h,'Marker','s','MarkerFaceColor','flat')
caxis([-md md])
xlabel(Xt)
title(['(Model-Data) ',kind,' ',parameter,' ',cruise])
set(gca,'TickDir','out')
load cmap_politoliu
colormap(politoliu)
colorbar
printgc('-f1','-depsc2',['./PLOT_VALIDATION/',upper(kind),'/',kind,'_diff_',cruise,'_',parameter,'_',bbio,'_y',year,'.eps'])
close all